Use typed UUIDs for silo user and group #8803
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit changes SiloUser and SiloGroup to use typed UUIDs.
The biggest reason that this couldn't happen without a bunch of work was the
lookup_resource
macro: for a resource like SshKey, it looked likeOne of the methods that the
lookup_resource
macro generates will create a lookup for ancestors of the resource, and this was one using the type returned from the corresponding authz resource'sid
method:Changing SiloUser to use a typed UUID in the authz resource:
and changing the
SiloUser
db model to useDbTypedUuid
meant that a call toto_db_typed_uuid
was required. The lookup_resource macro has no type information from the string "SiloUser", so this PR adds a check: if the ancestor string is suffixed with a '*', then the lookup_resource macro should assume that theparent_id
is a typed UUID, and generate the call toto_db_typed_uuid
.Most of the work after that was mechanical, changing Uuid to their typed equivalent, changing method argument types, etc etc.
Some other related things made it into this PR:
UserBuiltIn now also uses a typed UUID as well, distinguishing them from silo users
Actor no longer has the
actor_id
method, instead requiring call sites to check which variant of Actor is being usedAuthenticatedActor stores the full Actor instead of only the actor id, leading to typed comparisons in its oso::PolarClass impl
User and Group path params are now typed